<%@page import="entity.Product"%>
<%@page contentType="text/html;charset=utf-8"%>
<%@page import="java.util.List"%>
<%@page import="entity.Cart"%>
<%@page import="entity.CartItem"%>
<%@page import="util.TextFormat"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%
	Cart cart = (Cart)session.getAttribute("cart");
	List<CartItem> items = cart.list();
%>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>生成订单 - 当当网</title>
		<link href="<%=request.getContextPath()%>/css/login.css" rel="stylesheet" type="text/css"/>
		<link href="<%=request.getContextPath()%>/css/page_bottom.css" rel="stylesheet" type="text/css"/>
	</head>
	<body>
		<%@include file="../common/head1.jsp"%>
		<div class="login_step">
			生成订单骤:
			<span class="red_bold">1.确认订单</span> > 2.填写送货地址 > 3.订单成功
		</div>
		<div class="fill_message">

			<table class="tab_login">
				<tr>
					<td valign="top" class="w1" style="text-align: left">
						<b>序号</b>
					</td>
					<td valign="top" class="w1" style="text-align: left">
						<b>商品名称</b>
					</td>
					<td valign="top" class="w1" style="text-align: left">
						<b>商品单价</b>
					</td>
					<td valign="top" class="w1" style="text-align: left">
						<b>商品数量</b>
					</td>
					<td valign="top" class="w1" style="text-align: left">
						<b>小计</b>
					</td>
				</tr>

				<!-- 订单开始 -->
				<!-- <tr>
					<td valign="top"> -->
			<%
				for(int i = 0; i < items.size(); i++){
					CartItem item = items.get(i);
					Product product = item.getProduct();
					if(product.getHas_deleted().intValue() == 0){
			%>
						<tr>
							<td valign="top"><%=i + 1%></td>
							<td valign="top"><%=product.getProduct_name()%></td>
							<td valign="top"><%=TextFormat.formatNumber(product.getDang_price())%></td>
							<td valign="top"><%=item.getCount()%></td>
							<td valign="top"><%=TextFormat.formatNumber(item.getCount() * product.getDang_price())%></td>
						</tr>
			<%
					}
				}
			%>	
				<!-- 订单结束 -->
				<tr>
					<td valign="top" class="w1" style="text-align: left" colspan="5">
						<b>总价￥<%=TextFormat.formatNumber(cart.getTotalPrice())%></b>
					</td>
				</tr>
			</table>
			<br />
			<br />
			<br />
			<div class="login_in">
				<a href="<%=request.getContextPath()%>/cart/cartList.do">
					<input id="btnClientRegister" class="button_1" name="submit" type="submit" value="取消" />
				</a>
			
				<a href="<%=request.getContextPath()%>/order/addressForm.do">
					<input id="btnClientRegister" class="button_1" name="submit" type="submit" value="下一步"/>
				</a>
			</div>

		</div>
		<%@include file="../common/foot1.jsp"%>
	</body>
</html>

